<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head lang="en">
		<meta charset="utf-8" />
		<title>商品发布页</title>
		<link rel="stylesheet" type="text/css" href="../../css/public.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/mygxin.css" />
		<script type="text/javascript" src="../../js/sweetalert.min.js"></script>
	</head>
	<body>
		<!------------------------------head------------------------------>
		<div th:replace="~{front/public/topmargin::topbar}"></div>
		<!------------------------------idea------------------------------>
		<div class="address mt">
			<div class="wrapper clearfix">
				<a href="index" class="fl">首页</a>
				<span>/</span>
				<a href="mygxin">个人中心</a>
				<span>/</span>
				<a href="address" class="on">订单发布</a>
			</div>
		</div>
		
		<!------------------------------Bott------------------------------>
		<div class="Bott">
			<div class="wrapper clearfix">
				<div th:replace="~{front/public/sidebar::leftbar}"></div>
				<div class="you fl">
					<h2>发布商品</h2>
					<div class="add">
						<div>
							<a href="#2" id="addxad"><img src="../../img/jia.png"/></a>
							<span>添加商品</span>
						</div>
					</div>
					<br>
					<hr color="red">
					<br>
					<div class="FBSP" >
						<div class="SP" th:each="product,productStat:${products}">
							<p>商品名:<span th:text="${product.name}"></span></p>
							<p>商品描述:<span th:text="${product.description}"></span></p>
							<p>￥<span th:text="${product.price}"></span></p>
							<p>库存：<span th:text="${product.amount}"></span></p>
							<p>状态(0：待审核；1：在售；2：下架)：<span th:text="${product.state}"></span></p>
							<p>销量：<span th:text="${product.sales}"></span></p>
							<div class="productId" style="display: none" th:text="${product.productId}" ></div>
							<div class="userId" style="display: none" th:text="${product.userId}" ></div>
							<div class="name" style="display: none" th:text="${product.name}" ></div>
							<div class="price" style="display: none" th:text="${product.price}" ></div>
							<div class="amount" style="display: none" th:text="${product.amount}" ></div>
							<div class="description" style="display: none" th:text="${product.description}" ></div>
							<div class="category" style="display: none" th:text="${product.categoryId}" ></div>
							<div class="photo" style="display: none" th:text="${product.photo}" ></div>
							<script>
								$.cookie('name', );
							</script>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--编辑弹框-->
		<!--遮罩-->
		<div class="mask"></div>
<!--		添加商品form-->
		<div class="adddz">
			<form th:action="@{/upload}" id="addform" th:method="post" enctype="multipart/form-data">
				<input type="text" id="name" name="name" placeholder="商品名" />
				<input type="text" id="amount" name="amount" placeholder="商品数量" />
				<div class="city">
					<select id="category" name="category">
						<option  th:each="category,categoryStat:${category}" th:selected="${category.categoryId}" th:text="${category.name}" ></option>
					</select>
				</div>
				<input type="text" name="price" id="price" placeholder="价格" />
				<textarea name="description" id="description" rows="" cols="" placeholder="商品详情"></textarea>
					<input type="file" name="file" id="file" value="请选择文件">
<!--					<input type="submit" value="上传">-->
				<div class="bc">
					<input type="submit" value="保存" />
					<input type="button" value="取消" />
				</div>
			</form>
		</div>
<!--		修改商品-->
		<div class="readd" >
			<form th:action="@{/update}" th:method="post" enctype="multipart/form-data" id="updateform">
				<input type="text" id="name1" name="name1" placeholder="商品名" />
				<input type="text" id="productId" name="productId" placeholder="商品id" style="display: none" />
				<input type="text" id="amount1" name="amount1" placeholder="商品数量"  />
				<div class="city">
				<select id="category1" name="category1">
					<option  th:each="category,categoryStat:${category}" th:selected="${category.categoryId}" th:text="${category.name}" ></option>
				</select>
			</div>
				<input type="text" name="price1" id="price1"  placeholder="价格" />
				<textarea name="description1" id="description1"  rows="" cols="" placeholder="商品详情"></textarea>
				<input type="file" name="file" id="file1" value="请选择文件">
				<div class="bc">
					<input type="submit" id="editProduct" value="保存" />
					<input type="button" value="取消" />
				</div>
			</form>
		</div>
		<!--返回顶部-->
		<div class="gotop">
			<a href="cart">
			<dl>
				<dt><img src="../../img/gt1.png"/></dt>
				<dd>去购<br />物车</dd>
			</dl>
			</a>
			<a href="#" class="dh">
			<dl>
				<dt><img src="../../img/gt2.png"/></dt>
				<dd>联系<br />客服</dd>
			</dl>
			</a>
			<a href="mygxin">
			<dl>
				<dt><img src="../../img/gt3.png"/></dt>
				<dd>个人<br />中心</dd>
			</dl>
			</a>
			<a href="#" class="toptop" style="display: none">
			<dl>
				<dt><img src="../../img/gt4.png"/></dt>
				<dd>返回<br />顶部</dd>
			</dl>
			</a>
			<p>400-800-8200</p>
		</div>
		
		
		<!--footer-->
		<div class="footer">
			<div class="top">
				<div class="wrapper">
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot1.png"/></a>
						<span class="fl">7天无理由退货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot2.png"/></a>
						<span class="fl">15天免费换货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot3.png"/></a>
						<span class="fl">满599包邮</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot4.png"/></a>
						<span class="fl">手机特色服务</span>
					</div>
				</div>
			</div>
			<p class="dibu">最家家居&copy;2013-2017公司版权所有 京ICP备080100-44备0000111000号<br />
			违法和不良信息举报电话：400-800-8200，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</p>
		</div>
		<script src="../../js/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/public.js" type="text/javascript" charset="utf-8"></script>
<!--		<script src="../../js/user.js" type="text/javascript" charset="utf-8"></script>-->
		<script src="../../js/release.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery-form.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
<!--		<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>-->
<!--		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>-->
<!--		<script src="https://malsup.github.io/jquery.form.js"></script>-->

		<script type="text/javascript">
			$(document).ready(function () {
				console.log("from code itself1")
				console.log("cookie中的avatar=" + $.cookie("photo"));
				$("#img-avatar").attr("src", $.cookie("photo"));
			});

		</script>
<!--		<script>-->
<!--			$(function () {-->
<!--				$.getJSON('http://localhost:8080/findall', '', function(data) {-->
<!--					for ( var a = 0; a < data.length; a++) {-->
<!--						var b = "<option value="+data[a].code+">" + data[a].name+ "</option>";-->
<!--						$(".a").append(b);-->
<!--					};-->
<!--				});-->
<!--				$(".a").blur(function() {-->
<!--					var z = $(this).val();-->
<!--					// alert(z)-->
<!--					$.getJSON('http://localhost:8080/findbypid', 'pid=' + z, function(data) {-->
<!--						console.log(data)-->
<!--						$(".b").children().remove();-->
<!--						$(".c").children().remove();-->
<!--						for ( var a = 0; a < data.length; a++) {-->
<!--							var b = "<option value="+data[a].code+">"+ data[a].name + "</option>";-->
<!--							$(".b").append(b);-->
<!--						}-->
<!--					});-->
<!--				});-->
<!--				$(".b").blur(function() {-->
<!--					var c = $(this).val();-->
<!--					$.getJSON('http://localhost:8080/findbycid', 'cid=' + c, function(data) {-->
<!--						console.log(data)-->
<!--						$(".c").children().remove();-->
<!--						for ( var a = 0; a < data.length; a++) {-->
<!--							var city = "<option value="+data[a].code+">"+ data[a].name + "</option>";-->
<!--							$(".c").append(city);-->
<!--						}-->
<!--					});-->
<!--				});-->
<!--			})-->

<!--		</script>-->
	</body>


</html>
